# -*- coding: utf-8 -*-
# @File : playwrightStudy_实战1.py
# @Time : 2024/5/16 16:59
# @Author : syq
# @Email : 1721169065@qq.com
# @Software: PyCharm
"""
输出百度的首界面的热搜信息（打印出第一页的就行）
"""
#1导入同步包
from playwright.sync_api import sync_playwright
#2代码
with sync_playwright() as p:
    browser=p.chromium.launch(headless=False)
    page=browser.new_page()
    page.goto('https://www.baidu.com')
    #css定位
    listText=page.locator('.title-content-title').all_text_contents() #列表
    for text in listText:
        print(text)
    # page.wait_for_timeout(5000)


